<?php
class Article {
    private $id;
    private $name;
    private $long_name;
    private $date;
    private $text;
    private $section;
    private $image;
    private $videos;

    public function __construct() {
        $this->id=0;
        $this->name="Not found";
        $this->long_name="Not found";
        $this->date="0000-00-00";
        $this->text="Not found";
        $this->section=new Section();
        $this->image=new Image();
        $this->videos=array();
    }

    public function getId() {
        return $this->id;
    }

    public function getName(){
        return $this->name;
    }

    public function getLongName(){
        return $this->long_name;
    }

    public function getDate($fmt=NULL){
        if ($fmt==NULL)
            return $this->date;
        return date($fmt,strtotime($this->date));
    }

    public function getText(){
        return $this->text;
    }

    public function getSection(){
        return $this->section;
    }

    public function getImage(){
        return $this->image;
    }

    public function setId($id){
        $this->id=$id;
    }

    public function setName($name){
        $this->name=$name;
    }

    public function setLongName($long_name){
        $this->long_name=$long_name;
    }

    public function setDate($date){
        $this->date=$date;
    }

    public function setText($text){
        $this->text=$text;
    }

    public function setSection(Section $section){
        $this->section=$section;
    }

    public function setImage(Image $image){
        $this->image=$image;
    }

    public function setVideos($videos){
        $this->videos=$videos;
    }

    public function getVideos(){
        return $this->videos;
    }

    public function computePageId(){
        $reqTmp=new Request(0);
        $reqTmp->setArticleId($this->getId());
        $reqTmp->setSectionId($this->getSection()->getId());
        return $reqTmp->getPageId();
    }
}
?>
